#ifndef GAMEAPP_20170128
#define GAMEAPP_20170128

#include    "personal/common.h"
#include    "personal/scene/scene.h"
#include    "personal/windowHelp4gl/windowHelp4gl.h"
#include    "personal/font/fontmanager.h"

class GameApp
{
public:
    enum GameState
    {
        GAMESTATE_SPLASH = 0,
        GAMESTATE_LOADDING,
        GAMESTATE_MENU,
        GAMESTATE_RUNNING,
        GAMESTATE_PAUSED,
        GAMESTATE_CREDITS,
        GAMESTATE_NEXTLEVEL,
        GAMESTATE_OVER
    };


	GameApp();
	~GameApp();

private:
    WindowHelp4GL m_window;

	GameState m_state;

	typedef const char* Text;
	Text m_texts[GAMESTATE_OVER + 1];

    typedef void (GameApp::*LoadSceneFunction)();
	LoadSceneFunction m_loadFunctions[GAMESTATE_OVER + 1];

	typedef Scene* ScenePointer;
    ScenePointer m_scenes[GAMESTATE_OVER + 1];

    FontManager* m_fontManager;
private:
    int m_previousTime;
    bool m_run;

protected:
    void loadScene_splash();
	void loadScene_loadding();
	void loadScene_menu();
	void loadScene_running();
	void loadScene_paused();
	void loadScene_credits();
	void loadScene_nextlevel();
	void loadScene_over();

protected:
    void messageProcess();

	void render();
	void update(TimeSeconds detalTime);

	void initSomething();
	void releaseSomething();

public:
    void run();
    void exit();
    void loadScene(GameState state);
    void setGameState(GameState state);

    FontManager* getFontManager(){return m_fontManager;}
};

#endif // GAMEAPP_20170128
